package com.gopawpaw.android.app.maskanimation;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.FrameLayout;

public class MaskAnimationActivity extends Activity {
    /** Called when the activity is first created. */
	
	private MaskView mMaskView = null;
	
	private Handler mHandler = null;
	
	private FrameLayout mFrameLayout = null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        mHandler = new Handler();
        
        setContentView(R.layout.main);
        
        mFrameLayout = (FrameLayout) findViewById(R.id.framelayout_main);
        
        
        View vv = View.inflate(this, R.layout.layout_content_1, null); 
        
        initMaskView();
        
        
        mFrameLayout.addView(vv);
        mFrameLayout.addView(mMaskView);
        
    }
    
    
    private void initMaskView(){
    	mMaskView = new MaskView(this,mHandler,480,800);
    	
        Bitmap[] bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_4);
        
        AnimationItem ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(0));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_5);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(1));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_6);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(2));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_4);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(3));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_5);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(4));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_6);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(5));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_4);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(6));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_5);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(7));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
        
        bitmaps = new Bitmap[1];
        bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.drawable.bubble_size_6);
        ai = new AnimationItem();
        ai.setMovePath(mMaskView.getAnimationPath(8));
        ai.setNormalAnimaBitmaps(bitmaps);
        mMaskView.addAnimationItem(ai);
    }
    
}